package com.gsj.web.basecrotonller;

import com.gsj.domain.user.User;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpSession;

public abstract class BaseController {

    @Autowired
    protected HttpServletRequest request;

    @Autowired
    protected HttpSession httpSession;

    public User getLoginUser(){
        return (User) request.getSession().getAttribute("loginUser");
    }


    /**
     * 把登录用户写死
     * @return
     */
    public String getLoginCompanyId(){
        return getLoginUser().getCompanyId();
    }

    /**
     * 从登陆用户中获取所属企业id (先写死)
     * @return
     */
    public String getLoginCompanyName(){

        return getLoginUser().getCompanyName();
    }
}
